import { baseUrl, billBaseUrl } from "@/utils/config.js"
const placeholderStyle = 'color:#ccc;font-size:28rpx;font-weight: bold;'
const displayStyle = 'display: flex;align-items: center;justify-content: center;'
const inputStyle = {
  fontSize: '28rpx',
  textAlign: 'right',
  fontWeight: 'bold',
}
const rightStyle = 'width: 44rpx;height: 70rpx;display: flex;justify-content: flex-end;align-items: center;'
const inoutstockModel = {
  title: '出库/入库单',
  type: 'inoutstock',
  rules: {
    customerName: [{
      required: true,
      message: '请填写客户姓名',
      trigger: ['change', 'blur']
    }],
    actualAmount: [{
      required: true,
      message: '请填写应收金额',
      trigger: ['change', 'blur']
    }]
  },
  data: [
    [
      {
        key: 'customerName',
        type: 'input',
        inputType: 'text',
        label: '客户名称',
        placeholder: '填写客户名称',
        customStyle: inputStyle,
        placeholderStyle: placeholderStyle,
        required: true,
        height: 70,
        clearable: false,
        borderBottom: true,
        right: {
          style: rightStyle,
          img: billBaseUrl + 'tiaozhuantongxunlu@3x.png',
          label: '',
          imageViewStyle: displayStyle + 'width: 32rpx;height:32rpx;flex-shrink: 0;',
          func: 'chooseMember'
        },
      },
      {
        key: 'address',
        type: 'input',
        inputType: 'text',
        borderBottom: true,
        label: '服务地址',
        placeholder: '选择地址',
        customStyle: inputStyle,
        placeholderStyle: placeholderStyle,
        height: 70,
        clearable: false,
        borderBottom: true,
        right: {
          style: rightStyle,
          img: baseUrl + 'didian@3x.png',
          label: '',
          imageViewStyle: displayStyle + 'width: 28rpx;height:32rpx;flex-shrink: 0;',
          func: 'getAddress'
        },
      },
      {
        key: 'timeInfo',
        type: 'time',
        label: '服务时间',
        borderBottom: true,
        list: [{
          key: 'day',
          img: baseUrl + 'riqi@3x.png',
          placeholder: '选择服务日期',
          func: 'handleClickDate',
          ref: {
            key: 'timeInfo',
            subKey: 'day',
            type: 'date',
            show: false,
            ref: 'day',
          }
        }, {
          key: 'time',
          img: baseUrl + 'shijian@3x.png',
          placeholder: '选择时间',
          func: 'handleClickTime',
          ref: {
            key: 'timeInfo',
            subKey: 'time',
            type: 'time',
            show: false,
          }
        }]
      },
    ], [
      {
        key: 'expenseDetails',
        type: 'expenseDetails',
        label: '收据明细',
        ref: 'particulars-create'
      }
    ], [
      {
        type: 'money',
        placeholderStyle: 'color:#ccc;font-size:28rpx;font-weight: bold;',
        customStyle: {
          fontSize: '28rpx',
          textAlign: 'right',
          fontWeight: 'bold'
        },
        labels: {
          expenseDetails: '收据明细',
          receivableAmount: '应收金额',
          actualAmount: '实收金额',
          resultAmount: '欠款金额',
          repairTime: '服务时间'
        }
      }
    ], [
      {
        key: 'remark',
        type: 'textarea',
        inputType: 'indicate-remark',
        label: '备注信息',
        placeholder: '举例：货到验明，如有错漏请及时通知',
        style: 'min-height: 240rpx;',
        func: 'editRemark',
		right: {
		  label: '选模板',
		  func: 'chooseRemark'
		}
      }
    ], [
      {
        key: 'extend',
        subKey: 'customerSignSwitch',
        type: 'switch',
        label: '是否需要客户签字'
      }
    ],
    [
      {
        key: 'extend',
        type: 'seal',
      }
    ]],
  sealInfos: [
    {
      label: "水印",
      selectText: '选择电子水印',
      url: '',
      selected: true,
      value: '1',
      code: 'ELECTRON',
      width: 148,
    },
    {
      label: "公章",
      selectText: '选择公章',
      url: '',
      selected: false,
      value: '2',
      code: 'OFFICIAL',
      width: 148,
    },
    {
      label: "私章",
      selectText: '选择私章',
      url: '',
      selected: false,
      value: '4',
      code: 'PERSON',
      width: 148,
    },
    {
      label: "不使用",
      url: '',
      selected: false,
      value: '3',
      code: '',
      width: 148,
    }
  ],
  initFormFunc: (form) => {
    form.actualAmount = 0
  },
  changeFormFunc: (val)=> {
    let form = JSON.parse(JSON.stringify(val))
    form.repairTime = form.timeInfo.day + ' ' + form.timeInfo.time
    return form
  },
  setFormFunc: (form)=> {
  }
}

export default inoutstockModel